/**
 * 版权所有 (C), 2019-2019, XXX有限公司
 * 项目名：com.company.study.designpatterns.flyweight
 * 文件名: Test
 * 日期: 2019/6/16 11:00
 * 说明:
 */
package com.company.study.designpatterns.flyweight;

/**
 * @author Anbang713
 * @create 2019/6/16
 */
public class Test {
    public static void main(String[] args) {

        FlyweightFactory factory = new FlyweightFactory();

        Flyweight javaFlyweight = factory.getFlyweight("java");
        javaFlyweight.operation("a");

        Flyweight goFlyweight = factory.getFlyweight("go");
        goFlyweight.operation("b");

        Flyweight javaFlyweight1 = factory.getFlyweight("java");
        javaFlyweight1.operation("c");

        System.out.println(javaFlyweight == javaFlyweight1);
        System.out.println("Flyweight 总数：" + factory.getFlyweightSize());
    }
}